package com.linkallcloud.core.dto;

import java.util.Date;

import com.alibaba.fastjson2.annotation.JSONField;
import org.springframework.beans.BeanUtils;

import com.linkallcloud.core.util.ImageUtils;
import com.linkallcloud.core.vo.Vo;

public class Archive extends Vo {
    private static final long serialVersionUID = 2651771149219820440L;

    protected Long id;
    protected String uuid;
    @JSONField(serialize = false, format = "yyyy-MM-dd HH:mm:ss")
    protected Date createTime; // 创建时间
    @JSONField(serialize = false, format = "yyyy-MM-dd HH:mm:ss")
    protected Date updateTime; // 更新时间
    protected int status; // 状态

    private Long appId;
    private String appName;
    private String objectId;
    private Long objectType;
    private String realName;
    private String path;
    private Integer fileType;
    private String mimeType;
    private Long size;
    private Long time;
    private Integer ckeditorFile = 0;

    public Archive() {
        super();
    }

    public Archive(Object o) {
        if (o != null) {
            try {
                BeanUtils.copyProperties(o, this);
            } catch (Throwable e) {
                // log.warn("Fail to copy properties!", e);
            }
        }
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getUuid() {
        return uuid;
    }

    public void setUuid(String uuid) {
        this.uuid = uuid;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public Long getAppId() {
        return appId;
    }

    public void setAppId(Long appId) {
        this.appId = appId;
    }

    public String getAppName() {
        return appName;
    }

    public void setAppName(String appName) {
        this.appName = appName;
    }

    public String getObjectId() {
        return objectId;
    }

    public void setObjectId(String objectId) {
        this.objectId = objectId;
    }

    public Long getObjectType() {
        return objectType;
    }

    public void setObjectType(Long objectType) {
        this.objectType = objectType;
    }

    public String getRealName() {
        return realName;
    }

    public void setRealName(String realName) {
        this.realName = realName;
    }

    public String getPath() {
        return path;
    }

    public void setPath(String path) {
        this.path = path;
    }

    public Integer getFileType() {
        return fileType;
    }

    public void setFileType(Integer fileType) {
        this.fileType = fileType;
    }

    public String getMimeType() {
        return mimeType;
    }

    public void setMimeType(String mimeType) {
        this.mimeType = mimeType;
    }

    public Long getSize() {
        return size;
    }

    public void setSize(Long size) {
        this.size = size;
    }

    public Long getTime() {
        return time;
    }

    public void setTime(Long time) {
        this.time = time;
    }

    public Integer getCkeditorFile() {
        return ckeditorFile;
    }

    public void setCkeditorFile(Integer ckeditorFile) {
        this.ckeditorFile = ckeditorFile;
    }
    
    public String getIcon() {
        String fileExtName = ImageUtils.parseFileExtName(this.getRealName());
        if ("doc".equals(fileExtName) || "docx".equals(fileExtName)) {
            return "fa-file-word-o";
        } else if ("xls".equals(fileExtName) || "xlsx".equals(fileExtName)) {
            return "fa-file-excel-o";
        } else if ("ppt".equals(fileExtName) || "pptx".equals(fileExtName)) {
            return "fa-file-powerpoint-o";
        } else if ("pdf".equals(fileExtName)) {
            return "fa-file-pdf-o";
        } else if ("txt".equals(fileExtName)) {
            return "fa-file-text-o";
        } else if ("zip".equals(fileExtName) || "rar".equals(fileExtName)) {
            return "fa-file-zip-o";
        }
        return "fa-file-text-o";
    }

}
